// !@#$McCaBe-InStRuMeNtAtIoN$#@!
// Instrumented with the McCabe Java Parser
// Version: 8.1.0.1 - 20110309
// Using Path Vector Instrumentation
// Date: Sun Apr 01 2012 20:39:32
package EventManager;

import com.mccabe.*;


class AdminRequest_85ae7bc0c56e59e82a8ed1be645c0292 {
    static java.lang.Object info[];
    static {
        info = new java.lang.Object[2];
        info[0] = new Integer(-1);
        info[1] = new String("R:\\yu\\Concordia\\SOEN 344 Design II\\Term Assignment\\Code Repo\\trunk\\Iteration 3\\ERS\\src\\EventManager\\AdminRequest.java");
    }
}


/**
 * An abstract Administrator request. Most admin functions are of this type and won't be processed unless are 
 * issued by an admin.
 * 
 * @author Yury Kitaev
 *
 */
public abstract class AdminRequest extends Request
{

	private Administrator issuer;


	/**
	 * Constructor.
	 * @param issuer The administrator who issues the request.
	 */
	public AdminRequest (Administrator issuer)
	{
		super();
int _mcFreq_5d04a6216ba539e57e19377bc5cec826[] = PathVec_ERS_Iter3.getIntArray(0);
PathVec_ERS_Iter3.releaseIntArray();
PathVec_ERS_Iter3.enterConstructorWithECC(AdminRequest_85ae7bc0c56e59e82a8ed1be645c0292.info,0,_mcFreq_5d04a6216ba539e57e19377bc5cec826,0);

		setIssuer(issuer);
	}
	
	/**
	 * Only an administrator can issue Admin requests. This method shall be overridden, but it is useful to call it from the subclass to do null checks and other (potentially) useful things.
	 * @param issuer The pointer to the Administrator who issues the request.
	 */
	public void process (Administrator issuer)
	{
int _mcFreq_d472661b95b9ab579fba938a39fdfc08[] = new int[3];
PathVec_ERS_Iter3.enterMethod(AdminRequest_85ae7bc0c56e59e82a8ed1be645c0292.info,1,_mcFreq_d472661b95b9ab579fba938a39fdfc08,2);

		if (
PathVec_ERS_Iter3.decision(AdminRequest_85ae7bc0c56e59e82a8ed1be645c0292.info,1,_mcFreq_d472661b95b9ab579fba938a39fdfc08,0,1,
PathVec_ERS_Iter3.testCondition(null == issuer
))
)
		{
			throw new NullPointerException("The issuer of the admin request must be identified!");
		}
	}
	
	@Override
	public final void process()
	{
int _mcFreq_976b88c3d73d4bef6ccc5f11cd1bbdd8[] = new int[1];
PathVec_ERS_Iter3.enterMethod(AdminRequest_85ae7bc0c56e59e82a8ed1be645c0292.info,2,_mcFreq_976b88c3d73d4bef6ccc5f11cd1bbdd8,0);

		// Refuse requests by non-administrators
		setStatus(RequestStatus.Refused);
	}
	
	@Override
	public String toString() 
	{
int _mcFreq_40b5db59452b7d1bb61a8c02dbabef6d[] = new int[1];
PathVec_ERS_Iter3.enterMethod(AdminRequest_85ae7bc0c56e59e82a8ed1be645c0292.info,3,_mcFreq_40b5db59452b7d1bb61a8c02dbabef6d,0);

		return this.getClass().toString() +  " issued by " + issuer + "; status = " + getStatus().toString().toUpperCase();
	}

	public Administrator getIssuer() 
	{
int _mcFreq_34dc6657dcd9d046ca47a95a8a23e9c9[] = new int[1];
PathVec_ERS_Iter3.enterMethod(AdminRequest_85ae7bc0c56e59e82a8ed1be645c0292.info,4,_mcFreq_34dc6657dcd9d046ca47a95a8a23e9c9,0);

		return issuer;
	}

	public void setIssuer(Administrator issuer) 
	{
int _mcFreq_5bd54c9aaff132834a987a8aef12928f[] = new int[1];
PathVec_ERS_Iter3.enterMethod(AdminRequest_85ae7bc0c56e59e82a8ed1be645c0292.info,5,_mcFreq_5bd54c9aaff132834a987a8aef12928f,0);

		this.issuer = issuer;
	}
}
